home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Gigarom 1
/
Gigarom Macintosh Archives (Quantum Leap)(CDRM1080320)(1993).iso
/
FILES
/
HYP
/
E-G
/
Get DA Names.cpt
/
Get DA Names
/
card_3880.txt
< prev
next >
Wrap
Text File
|
1989-02-26
|
10KB
|
334 lines
-- card: 3880 from stack: in
-- bmap block id: 4900
-- flags: 0000
-- background id: 2777
-- name: Play with Get DA Names
----- HyperTalk script -----
on openCard
put empty into card field "Button ID"
hide card field "Button ID"
end openCard
on closeCard
-- If there is already a DA-launching button on this card,
-- then delete it
if card field "Button ID" is not empty and the number of card buttons > 5 then
set cursor to 4
set lockScreen to true
put item 1 of card field "Button ID" into buttonID
choose button tool
click at the loc of card button ID buttonID
doMenu "Clear button"
choose browse tool
put empty into card field "Button ID"
set lockScreen to false
end if
end closeCard
-- part 2 (button)
-- low flags: 00
-- high flags: 8004
-- rect: left=14 top=107 right=129 bottom=182
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: Make a button for a DA
----- HyperTalk script -----
on mouseUp
-- Display the watch cursor
set cursor to 4
-- Get the names of the DAs, putting these into the container
-- "namesOfDAs" in item list format
getDANames
-- Ask for the name of a desk accessory
-- See James L. Paul's "HyperList" stack for more
-- information about the DoList command
DoList "Select","Cancel",namesOfDAs,one
-- If a choice was made, then put the name of the item chosen
-- into a temporary variable; otherwise exit this script
if the result > 0 then
put item 2 of the result into daName
else
exit mouseUp
end if
-- "Freeze" the screen while a button is being made and displayed
set lockScreen to true
-- If there is already a DA-launching button on this card,
-- then delete it
if card field "Button ID" is not empty and the number of card buttons > 5 then
put item 1 of card field "Button ID" into buttonID
choose button tool
click at the loc of card button ID buttonID
doMenu "Clear button"
choose browse tool
end if
-- Make the new button
doMenu "New Button"
hide button "New Button"
put daName into nameOfButton
set name of button "New Button" to nameOfButton
-- Use the suitcase icon for DAs which has been pasted into
-- this stack, and given the name "DA suitcase"
set icon of button nameOfButton to "DA suitcase"
set style of button nameOfButton to shadow
put 50 into leftSide
put 140 into topSide
set rect of button nameOfButton to leftSide, topSide, leftSide + 100, topSide + 50
-- Store the button ID of the newly-created button, so
-- that it can be deleted later
put ID of button nameOfButton into card field "Button ID"
-- Construct the script for the new button and place it
-- into the button's script
put "on mouseUp" & return into buttonScript
put "doMenu" && quote & daName & quote & Return after buttonScript
put "end mouseUp" & Return after buttonScript
set script of button nameOfButton to buttonScript
-- Clean up things and flash the newly-created button
show button nameOfButton
choose browse tool
set lockScreen to false
repeat 2
set the hilite of button nameOfButton to true
set the hilite of button nameOfButton to false
end repeat
end mouseUp
-- part 3 (button)
-- low flags: 00
-- high flags: 8004
-- rect: left=12 top=65 right=86 bottom=182
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: Launch a DA
----- HyperTalk script -----
on mouseUp
set cursor to 4
-- Put the list of the names of the DAs in the apple menu into
-- the container, "namesOfDAs"
GetDANames
-- Use James L. Paul's DoList (ListManager) routine to display a list
-- of DAs, from which one can select a DA to launch
DoList "Select","Cancel",namesOfDAs,one
if the result is not empty then
put item 2 of the result into DAToOpen
doMenu DAToOpen
end if
end mouseUp
-- part 14 (field)
-- low flags: 81
-- high flags: 0000
-- rect: left=16 top=285 right=302 bottom=86
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 0
-- font id: 3
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: Button ID
-- part 26 (button)
-- low flags: 00
-- high flags: 8004
-- rect: left=14 top=220 right=242 bottom=182
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: Copy numberOfDAs XFCN
----- HyperTalk script -----
on mouseUp --DO NOT CHANGE LINE 2! IT IS MODIFIED BY ANOTHER SCRIPT!
put "HD20:HyperCard:Example stacks:Get DA Names" into sourceStack
put the long name of this stack into destStack
delete first word of destStack
delete first character of destStack
delete last character of destStack
if sourceStack<>destStack then
set lockscreen to true
set lockmessages to true
push this card
go stack sourceStack
ResCopy sourceStack,destStack,"XFCN","numberOfDAs"
get the result
-- here is where you would copy more resources.
pop card
choose button tool
click at location of card button "Copy numberOfDAs XFCN"
domenu clear button
choose browse tool
set lockmessages to false
set lockscreen to false
if first char of it is "E" then
put char 4 of it into errorNumber
errorMessage errorNumber -- defined below
else
answer "Resource copied successfully to this stack." with "OK"
end if
end if
end mouseUp
on errorMessage errorNumber
if errorNumber = 1 then
answer "The wrong number of parameters were passed." with "OK"
else if errorNumber = 2 then
answer "The source file couldn't be opened." with "OK"
else if errorNumber = 3 then
answer "A new destination file couldn't be created." with "OK"
else if errorNumber = 4 then
answer "The resource to be copied wasn't found in the source." with "OK"
end if
end errorMessage
-- part 27 (button)
-- low flags: 00
-- high flags: 8004
-- rect: left=14 top=246 right=268 bottom=182
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: Copy GetDANames XCMD
----- HyperTalk script -----
on mouseUp --DO NOT CHANGE LINE 2! IT IS MODIFIED BY ANOTHER SCRIPT!
put "HD20:HyperCard:Example stacks:Get DA Names" into sourceStack
put the long name of this stack into destStack
delete first word of destStack
delete first character of destStack
delete last character of destStack
if sourceStack<>destStack then
set lockscreen to true
set lockmessages to true
push this card
go stack sourceStack
ResCopy sourceStack,destStack,"XCMD","GetDANames"
get the result
-- here is where you would copy more resources.
pop card
choose button tool
click at location of card button "Copy GetDANames XCMD"
domenu clear button
choose browse tool
set lockmessages to false
set lockscreen to false
if first char of it is "E" then
put char 4 of it into errorNumber
errorMessage errorNumber -- defined below
else
answer "Resource copied successfully to this stack." with "OK"
end if
end if
end mouseUp
on errorMessage errorNumber
if errorNumber = 1 then
answer "The wrong number of parameters were passed." with "OK"
else if errorNumber = 2 then
answer "The source file couldn't be opened." with "OK"
else if errorNumber = 3 then
answer "A new destination file couldn't be created." with "OK"
else if errorNumber = 4 then
answer "The resource to be copied wasn't found in the source." with "OK"
end if
end errorMessage
-- part 28 (button)
-- low flags: 00
-- high flags: 8004
-- rect: left=14 top=273 right=295 bottom=182
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: Copy 'suitcase' icon
----- HyperTalk script -----
on mouseUp --DO NOT CHANGE LINE 2! IT IS MODIFIED BY ANOTHER SCRIPT!
put "HD20:HyperCard:Example stacks:Get DA Names" into sourceStack
put the long name of this stack into destStack
delete first word of destStack
delete first character of destStack
delete last character of destStack
if sourceStack<>destStack then
set lockscreen to true
set lockmessages to true
push this card
go stack sourceStack
ResCopy sourceStack,destStack,"ICON","DA suitcase"
get the result
-- here is where you would copy more resources.
pop card
choose button tool
click at location of card button "Copy 'suitcase' icon"
domenu clear button
choose browse tool
set lockmessages to false
set lockscreen to false
if first char of it is "E" then
put char 4 of it into errorNumber
errorMessage errorNumber -- defined below
else
answer "Resource copied successfully to this stack." with "OK"
end if
end if
end mouseUp
on errorMessage errorNumber
if errorNumber = 1 then
answer "The wrong number of parameters were passed." with "OK"
else if errorNumber = 2 then
answer "The source file couldn't be opened." with "OK"
else if errorNumber = 3 then
answer "A new destination file couldn't be created." with "OK"
else if errorNumber = 4 then
answer "The resource to be copied wasn't found in the source." with "OK"
end if
end errorMessage